package main

import (
  "log"
  "tingshu/internal/spider"

  "github.com/spf13/pflag"
)

var (
  seed  = pflag.StringP("seed", "s", "", "seed url for spider")
  dest  = pflag.StringP("dest", "d", "", "audio storage destination")
  help  = pflag.BoolP("help", "h", false, "show cmd usage")
  start = pflag.IntP("start", "t", 1, "start index")
)

func main() {
  pflag.Parse()
  if *help {
    pflag.Usage()
    return
  }

  if *seed == "" {
    log.Fatal("seed not provided")
  }

  if *dest == "" {
    log.Fatal("dest not provided")
  }

  spider.Run(*seed, *dest, *start)
}
